plugins: VOsc/VOsc3 - fix crash with negative buffer numbers
[supercollider.git] / examples / GUI examples / rotary hommage duchamp.scd
blob5a2dcf725967d20c8648789d8735a84fa98814c2
2 // rotary hommage ˆ Duchamp
3 // Julian Rohrhuber 2006
5                 var  w, width, center, bounds, a, b, c, z = 0, colors, fillOrStroke, shape;
6                 var rate = 25, speed = 33, seed = Date.seed;
7                 width = 1;
8                 w = Window("o").front;
9                 w.view.background_(Color.black);
10                 colors = [Color.new255(255, 150, 0).alpha_(0.5), Color.black.alpha_(0.5)];
11                 fillOrStroke = [Pen.fillOval(_), Pen.strokeOval(_)];
12                 shape = { (2 ** rrand(1, 5)).asInteger + rrand(0, 4) }.dup(rrand(5, 7));
13                 shape = shape.sort.reverse;
14                 w.drawHook = {
15                         thisThread.randSeed = seed;
16                         Pen.width = width;
17                         center = 30;
18                         Pen.translate(0, 0);
19                         z = z + (speed / rate);
20                         
21                         Pen.beginPath; 
22                         bounds = Rect.aboutPoint(w.view.bounds.center, 100, 100);
23                         shape.do { |i, j|
24                                 var bb;
25                                 a = sin(z * 0.1 + (j / 10));
26                                 b = sin(z * 0.13 + (j / 4));
27                                 c = sin(z * 0.45);
28                                 bounds = bounds.insetBy(i, i);
29                                 bb = bounds.moveBy(13 * a, 13 * b);
30                                 Pen.color=colors.wrapAt(i);
31                                 Pen.width = 30.rand;
32                                 fillOrStroke.choose.value(bb);
33                         };
34                         Pen.stroke;
35                         
36                 };
37                 w.refresh;
38                         fork {Êloop {Êrate.reciprocal.wait; defer {Êw.refresh; } } };